package com.mxpio.erp.common.quality.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_QUALITY_II")
@Schema(description="检测项目")//质检项目
public class InspectionItem extends BaseEntity{
	private static final long serialVersionUID = 1L;

	@Id
	@Generator(policy = ResCodeGeneratorPolicy.class)
	@Column(name = "CODE_", updatable = false)
	@Schema(description = "项目编号")
	private String code;

	@Column(name = "NAME_")
	@Schema(description = "项目名称")
	private String name;

	@Column(name = "BPMN_STATUS_")
	@Schema(description = "审核状态")
	@Dict(dicCode = "ERP_COMMON_BPMN_STATUS")
	private String bpmnStatus;

	@Column(name = "REVIEWER_")
	@Schema(description = "审核人")
	@Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
	private String reviewer;

	@Column(name = "REVIEW_TIME_")
	@Schema(description = "审核时间")
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date reviewTime;

	@Column(name = "ITEM_CLASS_")
	@Schema(description = "项目分类")
	@Dict(dicCode = "ERP_QUAL_II_CLASS")
	private String itemClass;

	@Column(name = "ITEM_TYPE_")
	@Schema(description = "项目类型")
	@Dict(dicCode = "ERP_QUAL_II_TYPE")
	private String itemType;

	@Column(name = "DEFECT_GRADE_")
	@Schema(description = "缺陷等级")
	@Dict(dicCode = "ERP_QUAL_II_DEFECT_GRADE")
	private String defectGrade;

	@Column(name = "STANDARD_")
	@Schema(description = "检验标准")
	private String standard;

	@Column(name = "DETECTION_TOOL_")
	@Schema(description = "检测工具")
	private String detectionTool;

	@Column(name = "DETECTION_METHOD_")
	@Schema(description = "检测方法")
	private String detectionMethod;

	@Column(name = "TECHNICAL_REQUIREMENTS_")
	@Schema(description = "技术要求")
	private String technicalRequirements;

	@Transient
	private List<InspectionItemParam> paramList;
}
